package com.sdgs.paas.sdk.core.jpa;

import javax.persistence.EntityManager;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.querydsl.jpa.impl.JPAQueryFactory;
import com.sdgs.paas.sdk.core.log.PaasLogger;

/**
 * 数据库功能自动配置
 *
 * @author wjj
 *
 */
@Configuration
public class PaasJpaAutoConfiguration {

	@Bean
	public JPAQueryFactory jPAQueryFactory(EntityManager em) {
		JPAQueryFactory queryFactory = new JPAQueryFactory(em);
		PaasLogger.info("JPAQueryFactory创建成功!");
		return queryFactory;
	}

	@Bean
	public IPaasJpaRepositoryHelper paasJpaRepositoryHelperImpl() {
		PaasJpaRepositoryHelperImpl paasJpaRepositoryHelperImpl = new PaasJpaRepositoryHelperImpl();
		PaasLogger.info("IPaasJpaRepositoryHelper创建成功!");
		return paasJpaRepositoryHelperImpl;
	}

}
